﻿@{
    ViewBag.Title = "支付验证";
    Layout = "~/Views/Shared/_MallLayout.cshtml";
    decimal needRedDrill = ViewBag.needRedDrill;
    decimal needRMB = ViewBag.needRMB;
}

<body class="page-reg bg-white page-payVerfication">
    <div class="box">
        <div class="fn-center">
            <p class="mb20">
                <em class="fn30 mr10">红钻支付</em>
                <em class="fn60 col-red">@(needRedDrill.ToString("0.######"))</em>
                <em class="fn30 col-red">个</em>
            </p>
            <p class="fn28">
                <span class="col-gray">或联系客服现金支付</span> <em class="fn-bold col-black">@(needRMB.ToString("0.######"))</em> <span class="col-gray">元</span>
            </p>
        </div>
        <div class="fn30 mb30">
            请输入拓垦登录密码
        </div>
        <div class="ui-item flex mb80">
            <div class="flex-1">
                <input class="ui-input fn28" id="password" type="password" value="" placeholder="请输入登录密码">
            </div>
        </div>
        <div class="flex mb40">
            <a id="confirmPay" href="javascript:void(0);" class="ui-btn ui-btn-lg ui-btn-cancel flex-1">确定</a>
        </div>
    </div>

    <script>
        $(function () {
            $("#password").bind("input propertychange", function () {
                var oSelf = $(this),
                    oLength = oSelf.val().length;
                if (oLength == 0) {
                    $(".ui-btn").addClass("ui-btn-cancel").removeClass("ui-btn-red");
                } else {
                    $(".ui-btn").addClass("ui-btn-red").removeClass("ui-btn-cancel");
                }
            });

            $('#confirmPay').click(function () {
                if ($(this).hasClass('ui-btn-cancel'))
                    return false;

                $(".ui-btn").addClass("ui-btn-cancel").removeClass("ui-btn-red");
                $.ajax({
                    url: '/Task/OpenSupplierPost',
                    type: 'POST',
                    data: { password: $("#password").val() },
                    async: false,
                    success: function (result) {
                        if (result.result_code == 1000) {
                            layer.msg("开通成功");
                            setTimeout(function () { window.location.href = '/Task/OpenSupplier'; }, 1000);
                        } else {
                            layer.msg(result.result_msg);
                            $(".ui-btn").addClass("ui-btn-red").removeClass("ui-btn-cancel");
                        }
                    }
                })
            })
        })
    </script>
</body>

